home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_02
/
1102107a
< prev
next >
Wrap
Text File
|
1992-12-02
|
774b
|
41 lines
void new_pivot(void)
{
int i,j;
/* calculate the new pipvot equation */
for (j=0; j<COLUMNS; j++) {
table[leave_pos][j] =
table[leave_pos][j]/pivot_element;
}
}
void new_equation(void)
{
int i,j;
float enter_coef;
float new_pivot;
float new_pivot_equ;
/* calculate all the non-pivot EQUATIONS */
for (i=0;i<=ROWS;i++) {
enter_coef = -table[i][enter_pos];
/* if the pivot coefficient is zero,
or if this is the leaving equation,
skip */
if ( (i == leave_pos)
|| (enter_coef == 0) )
continue;
for (j=0; j<COLUMNS; j++) {
new_pivot = table[leave_pos][j];
new_pivot_equ = new_pivot*enter_coef;
table[i][j] =
table[i][j] + new_pivot_equ;
}
}
}